package com.example.controller;

import com.example.common.Result;
import com.example.entity.RestrictedDocument;
import com.example.entity.RestrictedDocumentQuery;
import com.example.service.RestrictedDocumentService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/restricted-documents")
public class RestrictedDocumentsController {

    @Resource
    private RestrictedDocumentService restrictedDocumentService;

    @GetMapping("/selectPage")
    public Result selectPage(RestrictedDocumentQuery entity,
                             @RequestParam(defaultValue = "1") Integer pageNum,
                             @RequestParam(defaultValue = "10") Integer pageSize) {
        PageInfo<RestrictedDocument> page = restrictedDocumentService.selectPage(entity, pageNum, pageSize);
        return Result.success(page);
    }
}
